package group.rober.dataform.handler.impl;

import group.rober.dataform.handler.DataSingleHandler;
import group.rober.dataform.model.DataForm;

import java.util.Map;

/**
 * 默认实现JavaBean单个数据的基本处理<br/>
 * JavaBean的操作,该类必需为抽象类,因为它不知道数据类到底是什么,只能由实现类
 * Created by tisir<yangsong158@qq.com> on 2017-05-29
 */
public abstract class BeanSingleHandler<T> implements DataSingleHandler<T> {

    public void beforeCreateDataObject(DataForm dataForm, Map<String, Object> queryParameters) {

    }

    public T createDataObject(DataForm dataForm, Map<String, Object> queryParameters) {
        return null;
    }

    public void afterCreateDataObject(DataForm dataForm, Map<String, Object> queryParameters, T dataObject) {

    }

    public void beforeQuery(DataForm dataForm, Map<String, Object> queryParameters) {

    }

    public T query(DataForm dataForm, Map<String, Object> queryParameters) {
        return null;
    }

    public void afterQuery(DataForm dataForm, Map<String, Object> queryParameters, T dataObject) {

    }

    public T save(DataForm dataForm, T data) {
        return null;
    }

    public void beforeInsert(DataForm dataForm, T data) {

    }

    public void afterInsert(DataForm dataForm, T data) {

    }

    public void beforeUpdate(DataForm dataForm, T data) {

    }

    public void afterUpdate(DataForm dataForm, T data) {

    }

    public void beforeDelete(DataForm dataForm, T data) {

    }

    public Integer delete(DataForm dataForm, T data) {
        return null;
    }

    public void afterDelete(DataForm dataForm, T data) {

    }
}
